package com.group02.community.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.group02.community.entity.community.ZyBuilding;
import com.group02.community.entity.community.ZyUnit;
import com.group02.community.mapper.BuildingMapper;
import com.group02.community.service.BuildingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BuildingServiceImpl extends ServiceImpl<BuildingMapper,ZyBuilding> implements BuildingService {
    @Autowired
    private BuildingMapper buildingMapper;

    @Override
    public IPage<ZyBuilding> getBuildingPage(Integer currentPage, Integer pageSize, ZyBuilding zyBuilding) {
        return buildingMapper.getBuildingPage(new Page<>(currentPage,pageSize),zyBuilding);
    }

    @Override
    public List<String> getBuildingNames() {
        return buildingMapper.getBuildingNames();
    }

    @Override
    public List<ZyUnit> getUnitListByBuildingId(String buildingId) {
        return buildingMapper.getUnitListByBuildingId(buildingId);
    }
}
